///////////////////////////////////////////////////////////////////////////////
//
//                          IMPORTANT NOTICE
//
// The following open source license statement does not apply to any
// entity in the Exception List published by FMSoft.
//
// For more information, please visit:
//
// https://www.fmsoft.cn/exception-list
//
//////////////////////////////////////////////////////////////////////////////
/*
 *   This file is part of mGNCS, a component for MiniGUI.
 * 
 *   Copyright (C) 2008~2018, Beijing FMSoft Technologies Co., Ltd.
 * 
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 * 
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 * 
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 *   Or,
 * 
 *   As this program is a library, any link to this program must follow
 *   GNU General Public License version 3 (GPLv3). If you cannot accept
 *   GPLv3, you need to be licensed from FMSoft.
 * 
 *   If you have got a commercial license of this program, please use it
 *   under the terms and conditions of the commercial license.
 * 
 *   For more information about the commercial license, please refer to
 *   <http://www.minigui.com/blog/minigui-licensing-policy/>.
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>

#include <mgncs/mgncs.h>
#include "../include/mrdr.h"


#define _(name)  {#name, (const char*)(name)}

static const char * name_values[][2]={
	_(NCSP_BTNGRP_SELID),
	_(NCSP_BTNGRP_SELIDX),
	_(NCSP_BTNGRP_SELOBJ),
	_(NCSP_BTNGRP_MAX),
	_(NCSP_BUTTON_ALIGN),
	_(NCSP_BUTTON_VALIGN),
	_(NCSP_BUTTON_WORDWRAP),
	_(NCSP_BUTTON_IMAGE),
//	_(NCSP_BUTTON_IMAGEFILE),
	_(NCSP_BUTTON_CHECKSTATE),
	_(NCSP_BUTTON_IMAGE_SIZE_PERCENT),
	_(NCSP_BUTTON_GROUPID),
	_(NCSP_BUTTON_GROUP),
	_(NCSP_BUTTON_MAX),
	_(NCSP_CHKBTN_MAX),
#ifdef _MGNCSCTRL_COLORBUTTON
	_(NCSP_CLRBTN_CURCOLOR),
	_(NCSP_CLRBTN_MAX),
#endif
#ifdef _MGNCSCTRL_COMBOBOX
	_(NCSP_COMB_ITEMHEIGHT),
	_(NCSP_COMB_ITEMCOUNT),
	_(NCSP_COMB_DROPDOWNHEIGHT),
	_(NCSP_COMB_TEXTLIMIT),
	_(NCSP_COMB_SELECT),
	_(NCSP_COMB_MAX),
#endif
	_(NCSP_EDIT_LIMITTEXT),
	_(NCSP_EDIT_CARETPOS),
	_(NCSP_EDIT_MAX),
	_(NCSP_GRPBOX_MAX),
#ifdef _MGNCSCTRL_ICONVIEW
	_(NCSP_ICONV_MAX),
#endif
	_(NCSP_IMAGE_IMAGE),
	_(NCSP_IMAGE_IMAGEFILE),
	_(NCSP_IMAGE_DRAWMODE),
	_(NCSP_IMAGE_MAX),
	_(NCSP_IVCMPT_MAX),
	_(NCSP_ITEM_MAX),
	_(NCSP_ITMMNG_MAX),
	_(NCSP_ITEMV_MAX),
#ifdef _MGNCSCTRL_LEDLABEL
	_(NCSP_LEDLBL_COLOR),
	_(NCSP_LEDLBL_WIDTH),
	_(NCSP_LEDLBL_HEIGHT),
	_(NCSP_LEDLBL_MAX),
#endif
#ifdef _MGNCSCTRL_LISTBOX
	_(NCSP_LSTBOX_ITEMWIDTH),
	_(NCSP_LSTBOX_ITEMCOUNT),
	_(NCSP_LSTBOX_ITEMHEIGHT),
	_(NCSP_LSTBOX_TOPITEM),
	_(NCSP_LSTBOX_HILIGHTEDITEM),
	_(NCSP_LSTBOX_MAX),
#endif
	_(NCSP_LSTCLM_POSX),
	_(NCSP_LSTCLM_WIDTH),
	_(NCSP_LSTCLM_SORTTYPE),
	_(NCSP_LSTCLM_CMPFUNC),
	_(NCSP_LSTCLM_MAX),
	_(NCSP_LSTITM_MAX),
#ifdef _MGNCSCTRL_LISTVIEW
	_(NCSP_LISTV_HDRHEIGHT),
	_(NCSP_LISTV_HDRWIDTH),
	_(NCSP_LISTV_SORTCOLUMN),
	_(NCSP_LISTV_GRIDLINEWIDTH),
	_(NCSP_LISTV_GRIDLINECOLOR),
	_(NCSP_LISTV_MAX),
#endif
#ifdef _MGNCSCTRL_MENUBUTTON
	_(NCSP_MNUBTN_POPMENU),
	_(NCSP_MNUBTN_CURITEM),
	_(NCSP_MNUBTN_MAX),
#endif
	_(NCSP_MLEDIT_LINECOUNT),
	_(NCSP_MLEDIT_LINEHEIGHT),
	_(NCSP_MLEDIT_LINEFEEDISPCHAR),
	_(NCSP_MLEDIT_LINESEP),
	_(NCSP_MLEDIT_CARETSHAPE),
	_(NCSP_MLEDIT_NUMOFPARAGRAPHS),
	_(NCSP_MLEDIT_MAX),
#ifdef _MGNCSCTRL_MONTHCALENDAR
	_(NCSP_CDR_YEAR),
	_(NCSP_CDR_MONTH),
	_(NCSP_CDR_DAY),
	_(NCSP_CDR_MAX),
#endif
	_(NCSP_PANEL_MAX),
#ifdef _MGNCSCTRL_PROGRESSBAR
	_(NCSP_PROG_MAXPOS),
	_(NCSP_PROG_MINPOS),
	_(NCSP_PROG_CURPOS),
	_(NCSP_PROG_LINESTEP),
	_(NCSP_PROG_MAX),
#endif
#ifdef _MGNCSCTRL_PROPSHEET
	_(NCSP_PRPSHT_MINTABWIDTH),
	_(NCSP_PRPSHT_TABMARGIN),
	_(NCSP_PRPSHT_ACTIVEPAGE),
	_(NCSP_PRPSHT_ACTIVEPAGEIDX),
	_(NCSP_PRPSHT_FIRSTVIEWPAGE),
	_(NCSP_PRPSHT_FIRSTVIEWPAGEIDX),
	_(NCSP_PRPSHT_PAGECOUNT),
	_(NCSP_PRPSHT_MAX),
#endif
	_(NCSP_RDOBTN_MAX),
#ifdef _MGNCSCTRL_RECTANGLE
	_(NCSP_RECTANGLE_BORDERSIZE),
	_(NCSP_RECTANGLE_BORDERCOLOR),
	_(NCSP_RECTANGLE_FILLCOLOR),
	_(NCSP_RECTANGLE_XRADIUS),
	_(NCSP_RECTANGLE_YRADIUS),
	_(NCSP_RECTANGLE_MAX),
#endif
#ifdef _MGNCSCTRL_SCROLLBAR
	_(NCSP_SCRLBR_MAXPOS),
	_(NCSP_SCRLBR_MINPOS),
	_(NCSP_SCRLBR_CURPOS),
	_(NCSP_SCRLBR_LINESTEP),
	_(NCSP_SCRLBR_PAGESTEP),
	_(NCSP_SCRLBR_MAX),
#endif
	_(NCSP_SCRLV_MAX),
	_(NCSP_SWGT_CONTWIDTH),
	_(NCSP_SWGT_CONTHEIGHT),
	_(NCSP_SWGT_CONTX),
	_(NCSP_SWGT_CONTY),
	_(NCSP_SWGT_HSTEPVALUE),
	_(NCSP_SWGT_VSTEPVALUE),
	_(NCSP_SWGT_VISWIDTH),
	_(NCSP_SWGT_VISHEIGHT),
	_(NCSP_SWGT_MARGINRECT),
	_(NCSP_SWGT_DRAWMODE),
	_(NCSP_SWGT_MAX),
	_(NCSP_SLEDIT_TIPTEXT),
	_(NCSP_SLEDIT_PWDCHAR),
	_(NCSP_SLEDIT_MAX),
#ifdef _MGNCSCTRL_SLIDER
	_(NCSP_SLIDER_MAXPOS),
	_(NCSP_SLIDER_MINPOS),
	_(NCSP_SLIDER_CURPOS),
	_(NCSP_SLIDER_LINESTEP),
	_(NCSP_SLIDER_PAGESTEP),
	_(NCSP_SLIDER_MAX),
#endif
#ifdef _MGNCSCTRL_SPINNER
	_(NCSP_SPNR_MAXPOS),
	_(NCSP_SPNR_MINPOS),
	_(NCSP_SPNR_CURPOS),
	_(NCSP_SPNR_LINESTEP),
	_(NCSP_SPNR_TARGET),
	_(NCSP_SPNR_MAX),
#endif
#ifdef _MGNCSCTRL_SPINBOX
	_(NCSP_SPNBOX_MAXPOS),
	_(NCSP_SPNBOX_MINPOS),
	_(NCSP_SPNBOX_CURPOS),
	_(NCSP_SPNBOX_LINESTEP),
	_(NCSP_SPNBOX_MAX),
#endif
	_(NCSP_STATIC_ALIGN),
	_(NCSP_STATIC_VALIGN),
	_(NCSP_STATIC_AUTOWRAP),
	_(NCSP_STATIC_MAX),
	_(NCSP_TIMER_INTERVAL),
	_(NCSP_TIMER_MAX),
#ifdef _MGNCSCTRL_TOOLBAR
	_(NCSP_TLBAR_MAX),
#endif
#ifdef _MGNCSCTRL_TRACKBAR
	_(NCSP_TRKBAR_MAXPOS),
	_(NCSP_TRKBAR_MINPOS),
	_(NCSP_TRKBAR_CURPOS),
	_(NCSP_TRKBAR_LINESTEP),
	_(NCSP_TRKBAR_PAGESTEP),
	_(NCSP_TRKBAR_THUMB_WIDTH),
	_(NCSP_TRKBAR_THUMB_HEIGHT),
	_(NCSP_TRKBAR_MAX),
#endif
	_(NCSP_WIDGET_RDR),
	_(NCSP_WIDGET_TEXT),
	_(NCSP_WIDGET_BKIMAGE),
	_(NCSP_WIDGET_BKIMAGE_MODE),
	_(NCSP_WIDGET_BKIMAGE_FILE),
	_(NCSP_WIDGET_MAX),
	_(NCSN_BTNGRP_SELCHANGED),
	_(NCSN_BTNGRP_MAX),
	_(NCSN_CHKBTN_MAX),
#ifdef _MGNCSCTRL_COLORBUTTON
	_(NCSN_CLRBTN_COLORCHANGED),
	_(NCSN_CLRBTN_MAX),
#endif
#ifdef _MGNCSCTRL_COMBOBOX
	_(NCSN_CMBOX_SELCHANGE),
	_(NCSN_CMBOX_SETFOCUS),
	_(NCSN_CMBOX_KILLFOCUS),
	_(NCSN_CMBOX_EDITCHANGE),
	_(NCSN_CMBOX_DROPDOWN),
	_(NCSN_CMBOX_CLOSEUP),
	_(NCSN_CMBOX_SELECTOK),
	_(NCSN_CMBOX_SELECTCANCEL),
	_(NCSN_CMBOX_MAX),
#endif
#ifdef _MGNCSCTRL_CONTAINER
	_(NCSN_CTNR_MAX),
#endif
#ifdef _MGNCSCTRL_DIALOGBOX
	_(NCSN_DLGBOX_MAX),
#endif
	_(NCSN_EDIT_CHANGE),
	_(NCSN_EDIT_CONTCHANGED),
	_(NCSN_EDIT_UPDATE),
	_(NCSN_EDIT_SELCHANGED),
	_(NCSN_EDIT_MAXTEXT),
	_(NCSN_EDIT_SETFOCUS),
	_(NCSN_EDIT_KILLFOCUS),
	_(NCSN_EDIT_MAX),
	_(NCSN_GRPBOX_MAX),
#ifdef _MGNCSCTRL_ICONVIEW
	_(NCSN_ICONV_CLICKED),
	_(NCSN_ICONV_SELCHANGED),
	_(NCSN_ICONV_MAX),
#endif
	_(NCSN_IMAGE_MAX),
	_(NCSN_ITEMV_CLICKED),
	_(NCSN_ITEMV_SELCHANGING),
	_(NCSN_ITEMV_SELCHANGED),
	_(NCSN_ITEMV_ENTER),
	_(NCSN_ITEMV_SETFOCUS),
	_(NCSN_ITEMV_KILLFOCUS),
	_(NCSN_ITEMV_MAX),
#ifdef _MGNCSCTRL_LEDLABEL
	_(NCSN_LEDLBL_MAX),
#endif
#ifdef _MGNCSCTRL_LISTBOX
	_(NCSN_LSTBOX_CLICKED),
	_(NCSN_LSTBOX_SELCHANGED),
	_(NCSN_LSTBOX_ENTER),
	_(NCSN_LSTBOX_ERRSPACE),
	_(NCSN_LSTBOX_DBCLK),
	_(NCSN_LSTBOX_CMCANCEL),
	_(NCSN_LSTBOX_SETFOCUS),
	_(NCSN_LSTBOX_KILLFOCUS),
	_(NCSN_LSTBOX_CLKCHKMARK),
	_(NCSN_LSTBOX_MAX),
#endif
#ifdef _MGNCSCTRL_LISTVIEW
	_(NCSN_LISTV_CLICKED),
	_(NCSN_LISTV_SELCHANGED),
	_(NCSN_LISTV_ITEMRDOWN),
	_(NCSN_LISTV_ITEMRUP),
	_(NCSN_LISTV_HDRRDOWN),
	_(NCSN_LISTV_HDRRUP),
	_(NCSN_LISTV_ITEMDBCLK),
	_(NCSN_LISTV_FOLDITEM),
	_(NCSN_LISTV_UNFOLDITEM),
	_(NCSN_LISTV_MAX),
#endif
	_(NCSS_MNWND_MODE),
	_(NCSN_MNWND_MAX),
#ifdef _MGNCSCTRL_MENUBUTTON
	_(NCSN_MNUBTN_ITEMCHANGED),
	_(NCSN_MNUBTN_MAX),
#endif
	_(NCSN_MLEDIT_MAX),
#ifdef _MGNCSCTRL_MONTHCALENDAR
	_(NCSN_CDR_YEAR_CHANGED),
	_(NCSN_CDR_MONTH_CHANGED),
	_(NCSN_CDR_DAY_CHANGED),
	_(NCSN_CDR_MAX),
#endif
	_(NCSN_PANEL_MAX),
#ifdef _MGNCSCTRL_PROPSHEET
	_(NCSN_PRPSHT_ACTIVECHANGED),
	_(NCSN_PRPSHT_MAX),
#endif
	_(NCSN_RDOBTN_MAX),
#ifdef _MGNCSCTRL_RECTANGLE
	_(NCSN_RECT_MAX),
#endif
#ifdef _MGNCSCTRL_SCROLLBAR
	_(NCSN_SCRLBR_CHANGED),
	_(NCSN_SCRLBR_REACHMAX),
	_(NCSN_SCRLBR_REACHMIN),
	//_(NCSN_SCRLBR_STARTDRAG),
	//_(NCSN_SCRLBR_STOPDRAG),
	_(NCSN_SCRLBR_MAX),
#endif
	_(NCSN_SCRLV_CLICKED),
	_(NCSN_SCRLV_SELCHANGED),
	_(NCSN_SCRLV_SELCHANGING),
	_(NCSN_SCRLV_MAX),
	_(NCSN_SWGT_MAX),
	_(NCSN_SLEDIT_CHANGE),
	_(NCSN_SLEDIT_ENTER),
	_(NCSN_SLEDIT_MAX),
#ifdef _MGNCSCTRL_SLIDER
	_(NCSN_SLIDER_CHANGED),
	_(NCSN_SLIDER_REACHMAX),
	_(NCSN_SLIDER_REACHMIN),
	//_(NCSN_SLIDER_STARTDRAG),
	//_(NCSN_SLIDER_STOPDRAG),
	_(NCSN_SLIDER_MAX),
#endif
#ifdef _MGNCSCTRL_SPINNER
	_(NCSN_SPNR_CHANGED),
	_(NCSN_SPNR_REACHMAX),
	_(NCSN_SPNR_REACHMIN),
	_(NCSN_SPNR_MAX),
#endif
#ifdef _MGNCSCTRL_SPINBOX
	_(NCSN_SPNBOX_CHANGED),
	_(NCSN_SPNBOX_REACHMAX),
	_(NCSN_SPNBOX_REACHMIN),
	_(NCSN_SPNBOX_MAX),
	_(NCSN_STATIC_MAX),
#endif
#ifdef _MGNCSCTRL_TOOLBAR
	_(NCSN_TLBAR_ITEMCHAGED),
	_(NCSN_TLBAR_MAX),
#endif
	_(NCSN_TOOLITEM_CLICKED),
	_(NCSN_TOOLITEM_PUSHED),
	_(NCSN_TOOLITEM_SHOWMENU),
	_(NCSN_TOOLITEM_STATE_CHANGED),
#ifdef _MGNCSCTRL_TRACKBAR
	_(NCSN_TRKBAR_CHANGED),
	_(NCSN_TRKBAR_REACHMAX),
	_(NCSN_TRKBAR_REACHMIN),
	//_(NCSN_TRKBAR_STARTDRAG),
	//_(NCSN_TRKBAR_STOPDRAG),
	_(NCSN_TRKBAR_MAX),
#endif
	_(NCSN_WIDGET_CLICKED),
	_(NCSN_WIDGET_DBCLICKED),
	_(NCSN_WIDGET_ENABLED),
	_(NCSN_WIDGET_DISABLED),
	_(NCSN_WIDGET_MAX),
	_(NCSS_BTNGRP_SHIFT),
	_(NCSS_BUTTON_IMAGE),
	_(NCSS_BUTTON_CHECKABLE),
	_(NCSS_BUTTON_AUTOCHECK),
	_(NCSS_BUTTON_3DCHECK),
	_(NCSS_BUTTON_IMAGELABEL),
	_(NCSS_BUTTON_VERTIMAGELABEL),
	_(NCSS_BUTTON_SHIFT),
	_(NCSS_CHKBTN_SHIFT),
#ifdef _MGNCSCTRL_COLORBUTTON
	_(NCSS_CLRBTN_SHIFT),
	_(NCSS_CLRBTN_FLAT),
#endif
#ifdef _MGNCSCTRL_COMBOBOX
	_(NCSS_CMBOX_SIMPLE),
	_(NCSS_CMBOX_DROPDOWNLIST),
	_(NCSS_CMBOX_SORT),
	_(NCSS_CMBOX_EDITNOBORDER),
	_(NCSS_CMBOX_EDITBASELINE),
	_(NCSS_CMBOX_READONLY),
	_(NCSS_CMBOX_UPPERCASE),
	_(NCSS_CMBOX_LOWERCASE),
	_(NCSS_CMBOX_AUTOFOCUS),
	_(NCSS_CMBOX_SHIFT),
#endif
#ifdef _MGNCSCTRL_CONTAINER
	_(NCSS_CTNR_SHIFT),
#endif
#ifdef _MGNCSCTRL_DIALOGBOX
	_(NCSS_DLGBOX_SHIFT),
#endif
	_(NCSS_EDIT_LEFT),
	_(NCSS_EDIT_CENTER),
	_(NCSS_EDIT_RIGHT),
	_(NCSS_EDIT_UPPERCASE),
	_(NCSS_EDIT_LOWERCASE),
	_(NCSS_EDIT_NOHIDESEL),
	_(NCSS_EDIT_READONLY),
	_(NCSS_EDIT_BASELINE),
	_(NCSS_EDIT_SHIFT),
	_(NCSS_GRPBOX_SHIFT),
#ifdef _MGNCSCTRL_ICONVIEW
	_(NCSS_ICONV_SHIFT),
	_(NCSS_ICONV_SORT),
	_(NCSS_ICONV_LOOP),
#endif
	_(NCSS_IMAGE_SHIFT),
	_(NCSS_ITEMV_SHIFT),
	_(NCSS_ITEMV_AUTOSORT),
	_(NCSS_ITEMV_LOOP),
	_(NCSS_ITEMV_SINGLE),
	_(NCSS_ITEMV_MULTIPLE),
#ifdef _MGNCSCTRL_LISTBOX
	_(NCSS_LSTBOX_SHIFT),
	_(NCSS_LSTBOX_SINGLE),
	_(NCSS_LSTBOX_MULTIPLE),
	_(NCSS_LSTBOX_SORT),
	_(NCSS_LSTBOX_MOUSEFOLLOW),
	_(NCSS_LSTBOX_STRING),
	_(NCSS_LSTBOX_USEBITMAP),
	_(NCSS_LSTBOX_CHECKBOX),
	_(NCSS_LSTBOX_AUTOCHECK),
	_(NCSS_LSTBOX_AUTOCHECKBOX),
#endif
#ifdef _MGNCSCTRL_LISTVIEW
	_(NCSS_LISTV_NOTIFY),
	_(NCSS_LISTV_LOOP),
	_(NCSS_LISTV_MULTIPLE),
	_(NCSS_LISTV_CHECKBOX),
	_(NCSS_LISTV_AUTOCHECK),
	_(NCSS_LISTV_AUTOCHECKBOX),
	_(NCSS_LISTV_TREE),
	_(NCSS_LISTV_WITHICON),
	_(NCSS_LISTV_SORT),
	_(NCSS_LISTV_SHIFT),
#endif
	_(NCSS_MNWND_SHIFT),
#ifdef _MGNCSCTRL_MENUBUTTON
	_(NCSS_MNUBTN_SHIFT),
#endif
	_(NCSS_MLEDIT_AUTOWRAP),
	_(NCSS_MLEDIT_TITLE),
	_(NCSS_MLEDIT_SHIFT),
#ifdef _MGNCSCTRL_PAGE
	_(NCSS_PAGE_SHIFT),
#endif
	_(NCSS_PANEL_SHIFT),
#ifdef _MGNCSCTRL_PROGRESSBAR
	_(NCSS_PRGBAR_HORIZONTAL),
	_(NCSS_PRGBAR_VERTICAL),
	_(NCSS_PRGBAR_BLOCKS),
	_(NCSS_PRGBAR_SMOOTH),
	_(NCSS_PRGBAR_SHOWPERCENT),
	_(NCSS_PRGBAR_SHIFT),
#endif
#ifdef _MGNCSCTRL_PROPSHEET
	_(NCSS_PRPSHT_SHIFT),
	_(NCSS_PRPSHT_BTNMASK),
	_(NCSS_PRPSHT_TABMASK),
	_(NCSS_PRPSHT_SIMPLE),
	_(NCSS_PRPSHT_COMPACTTAB),
	_(NCSS_PRPSHT_SCROLLABLE),
	_(NCSS_PRPSHT_TOP),
	_(NCSS_PRPSHT_BOTTOM),
#endif
	_(NCSS_RDOBTN_SHIFT),
#ifdef _MGNCSCTRL_RECTANGLE
	_(NCSS_RECT_SHIFT),
#endif
#ifdef _MGNCSCTRL_SCROLLBAR
	_(NCSS_SCRLBR_HORIZONTAL),
	_(NCSS_SCRLBR_ARROWS),
	_(NCSS_SCRLBR_LEFTDBLARROWS),
	_(NCSS_SCRLBR_UPDBLARROWS),
	_(NCSS_SCRLBR_RIGHTDBLARROWS),
	_(NCSS_SCRLBR_DOWNDBLARROWS),
	_(NCSS_SCRLBR_SHIFT),
	_(NCSS_SCRLBR_VERTICAL),
	_(NCSS_SCRLBR_SHIFT), _(NCSS_SCRLV_SHIFT),
	_(NCSS_SCRLV_LOOP),
#endif
	_(NCSS_SWGT_SHIFT),
	_(NCSS_SLEDIT_PASSWORD),
	_(NCSS_SLEDIT_AUTOSELECT),
#ifdef _MGNCSCTRL_SLIDER
	_(NCSS_SLIDER_HORIZONTAL),
	_(NCSS_SLIDER_VERTICAL),
	_(NCSS_SLIDER_SHIFT),
#endif
#ifdef _MGNCSCTRL_SPINNER
	_(NCSS_SPNR_VERTICAL),
	_(NCSS_SPNR_HORIZONTAL),
	_(NCSS_SPNR_AUTOLOOP),
	_(NCSS_SPNR_SHIFT),
#endif
#ifdef _MGNCSCTRL_SPINBOX
	_(NCSS_SPNBOX_VERTICAL),
	_(NCSS_SPNBOX_HORIZONTAL),
	_(NCSS_SPNBOX_AUTOLOOP),
	_(NCSS_SPNBOX_NUMBER),
	_(NCSS_SPNBOX_STRING),
	_(NCSS_SPNBOX_SORT),
	_(NCSS_SPNBOX_EDITNOBORDER),
	_(NCSS_SPNBOX_EDITBASELINE),
	_(NCSS_SPNBOX_READONLY),
	_(NCSS_SPNBOX_UPPERCASE),
	_(NCSS_SPNBOX_LOWERCASE),
	_(NCSS_SPNBOX_AUTOFOCUS),
	_(NCSS_SPNBOX_SHIFT),
#endif
	_(NCSS_STATIC_PREFIX),
	_(NCSS_STATIC_SHIFT),
#ifdef _MGNCSCTRL_TOOLBAR
	_(NCSS_TLBAR_SHIFT),
#endif
#ifdef _MGNCSCTRL_TRACKBAR
	_(NCSS_TRKBAR_HORIZONTAL),
	_(NCSS_TRKBAR_VERTICAL),
	_(NCSS_TRKBAR_NOTICK),
	_(NCSS_TRKBAR_SHIFT),
#endif
	_(NCSS_NOTIFY),
	_(NCSS_WIDGET_SHIFT),
#ifdef _MGNCSCTRL_ANIMATE
	_(NCSS_ANMT_SHIFT),
	_(NCSS_ANMT_AUTOLOOP),
	_(NCSS_ANMT_SCALE),
	_(NCSS_ANMT_AUTOFIT),
	_(NCSP_ANMT_GIFFILE),
	_(NCSP_ANMT_DIR),
	//_(NCSP_ANMT_FILELIST),
	//_(NCSP_ANMT_ANIMATEFRAMES),
	//_(NCSP_ANMT_FRAMECOUNT),
	_(NCSP_ANMT_INTERVAL),
	_(NCSP_ANMT_MAX),
	_(NCSN_ANMT_MAX),
#endif
	_(NCS_FGC_BASEID),
	_(NCS_BGC_BASEID),
	_(NCS_FGC_3DBODY),
	_(NCS_BGC_3DBODY),
	_(NCS_FGC_WINDOW),
	_(NCS_BGC_WINDOW),
	_(NCS_FGC_SELECTED_ITEM),
	_(NCS_BGC_SELECTED_ITEM),
	_(NCS_FGC_HILIGHT_ITEM),
	_(NCS_BGC_HILIGHT_ITEM),
	_(NCS_FGC_DISABLED_ITEM),
	_(NCS_BGC_DISABLED_ITEM),
	_(NCS_BGC_SELITEM_NOFOCUS),
	_(NCS_BGC_PRGBAR_CHUNK),
	_(NCS_BGC_TRKBAR_SLIDER),
	_(NCS_BGC_TRKBAR_THUMB),
	_(NCS_MODE_BKIMAGE),
	_(NCS_MODE_BGC),
	_(NCS_MODE_FGC),
	_(NCS_MODE_ITEM),
	_(NCS_MODE_USEFLAT),
	_(NCS_IMAGE_BASEID),
	_(NCS_IMAGE_NUMBER),
	_(NCS_IMAGE_BKGND),
	_(NCS_IMAGE_ARROWS),
	_(NCS_IMAGE_ARROWSHELL),
	_(NCS_IMAGE_BUTTON),
	_(NCS_IMAGE_CHKBTN),
	_(NCS_IMAGE_RDOBTN),
	_(NCS_IMAGE_LISTV_TREE),
	_(NCS_IMAGE_LISTV_HDR),
	_(NCS_IMAGE_PRPSHT_TAB),
	_(NCS_IMAGE_PRGBAR_HCHUNK),
	_(NCS_IMAGE_PRGBAR_VCHUNK),
	_(NCS_IMAGE_PRGBAR_HSLIDER),
	_(NCS_IMAGE_PRGBAR_VSLIDER),
	_(NCS_IMAGE_TRKBAR_HSLIDER),
	_(NCS_IMAGE_TRKBAR_VSLIDER),
	_(NCS_IMAGE_TRKBAR_HTHUMB),
	_(NCS_IMAGE_TRKBAR_VTHUMB),
	_(NCS_METRICS_BASEID),
	_(NCS_METRICS_NUMBER),
	_(NCS_METRICS_3DBODY_ROUNDX),
	_(NCS_METRICS_3DBODY_ROUNDY),
///// MiniGUI 3.0 RDR IDs
	_(WE_FONTS_NUMBER),
	_(WE_METRICS_NUMBER),
	_(WE_COLORS_NUMBER),
	_(WE_ATTR_TYPE_MASK),
	_(WE_ATTR_TYPE_COLOR_MASK),
	_(WE_ATTR_INDEX_MASK),
	_(WE_ATTR_TYPE_FONT),
	_(WE_ATTR_TYPE_METRICS),
	_(WE_ATTR_TYPE_COLOR),
	_(WE_ATTR_TYPE_FGC),
	_(WE_ATTR_TYPE_BGCA),
	_(WE_ATTR_TYPE_BGCB),
	_(WE_CAPTION),
	_(WE_MENU),
	_(WE_MESSAGEBOX),
	_(WE_TOOLTIP),
	_(WE_WND_BORDER),
	_(WE_SCROLLBAR),
	_(WE_INACTIVE_CAPTION),
	_(WE_WINDOW),
	_(WE_THREED_BODY),
	_(WE_SELECTED_ITEM),
	_(WE_DISABLED_ITEM),
	_(WE_HIGHLIGHT_ITEM),
	_(WE_SIGNIFICANT_ITEM),
	_(WE_DESKTOP),
	_(WE_FONT_CAPTION),
	_(WE_METRICS_CAPTION),
	_(WE_FGC_ACTIVE_CAPTION),
	_(WE_BGCA_ACTIVE_CAPTION),
	_(WE_BGCB_ACTIVE_CAPTION),
	_(WE_FONT_MENU),
	_(WE_METRICS_MENU),
	_(WE_FGC_MENU),
	_(WE_BGC_MENU),
	_(WE_FONT_MESSAGEBOX),
	_(WE_FGC_MESSAGEBOX),
	_(WE_FONT_TOOLTIP),
	_(WE_FGC_TOOLTIP),
	_(WE_BGC_TOOLTIP),
	_(WE_METRICS_WND_BORDER),
	_(WE_FGC_ACTIVE_WND_BORDER),
	_(WE_FGC_INACTIVE_WND_BORDER),
	_(WE_METRICS_SCROLLBAR),
	_(WE_FGC_INACTIVE_CAPTION),
	_(WE_BGCA_INACTIVE_CAPTION),
	_(WE_BGCB_INACTIVE_CAPTION),
	_(WE_FGC_WINDOW),
	_(WE_BGC_WINDOW),
	_(WE_FGC_THREED_BODY),
	_(WE_MAINC_THREED_BODY),
	_(WE_FGC_SELECTED_ITEM),
	_(WE_BGC_SELECTED_ITEM),
	_(WE_BGC_SELECTED_LOSTFOCUS),
	_(WE_FGC_DISABLED_ITEM),
	_(WE_BGC_DISABLED_ITEM),
	_(WE_FGC_HIGHLIGHT_ITEM),
	_(WE_BGC_HIGHLIGHT_ITEM),
	_(WE_FGC_SIGNIFICANT_ITEM),
	_(WE_BGC_SIGNIFICANT_ITEM),
	_(WE_BGC_DESKTOP),
	_(WE_ATTR_TYPE_ICON),
	_(WE_ATTR_TYPE_ICON_MASK),
	_(WE_ATTR_TYPE_SMALLICON),
	_(WE_ATTR_TYPE_LARGEICON),
	_(WE_LARGEICON_APPLICATION),
	_(WE_LARGEICON_HAND),
	_(WE_LARGEICON_QUESTION),
	_(WE_LARGEICON_EXCLAMATION),
	_(WE_LARGEICON_ASTERISK),
	_(WE_LARGEICON_STOP),
	_(WE_LARGEICON_INFORMATION),
	_(WE_SMALLICON_APPLICATION),
	_(WE_SMALLICON_HAND),
	_(WE_SMALLICON_QUESTION),
	_(WE_SMALLICON_EXCLAMATION),
	_(WE_SMALLICON_ASTERISK),
	_(WE_SMALLICON_STOP),
	_(WE_SMALLICON_INFORMATION),
	_(WE_ATTR_TYPE_RDR),
	_(WE_LFSKIN_NUMBER),
	_(WE_LFSKIN_WND_BKGND),
	_(WE_LFSKIN_CAPTION),
	_(WE_LFSKIN_CAPTION_BTN),
	_(WE_LFSKIN_SCROLLBAR_VSHAFT),
	_(WE_LFSKIN_SCROLLBAR_VTHUMB),
	_(WE_LFSKIN_SCROLLBAR_HSHAFT),
	_(WE_LFSKIN_SCROLLBAR_HTHUMB),
	_(WE_LFSKIN_SCROLLBAR_ARROWS),
	_(WE_LFSKIN_BORDER_TOP),
	_(WE_LFSKIN_BORDER_BOTTOM),
	_(WE_LFSKIN_BORDER_LEFT),
	_(WE_LFSKIN_BORDER_RIGHT),
	_(WE_LFSKIN_ARROWS),
	_(WE_LFSKIN_ARROWS_SHELL),
	_(WE_LFSKIN_RADIOBUTTON),
	_(WE_LFSKIN_CHECKBUTTON),
	_(WE_LFSKIN_PUSHBUTTON),
	_(WE_LFSKIN_TREE),
	_(WE_LFSKIN_HEADER),
	_(WE_LFSKIN_TAB),
	_(WE_LFSKIN_PROGRESS_HCHUNK),
	_(WE_LFSKIN_PROGRESS_VCHUNK),
	_(WE_LFSKIN_PROGRESS_HTRACKBAR),
	_(WE_LFSKIN_PROGRESS_VTRACKBAR),
	_(WE_LFSKIN_TBSLIDER_H),
	_(WE_LFSKIN_TRACKBAR_VERT),
	_(WE_LFSKIN_TRACKBAR_HORZ),
	_(WE_LFSKIN_TBSLIDER_V),
	_(NCSS_TE_READONLY),
	_(NCSS_TE_UPPERCASE),
	_(NCSS_TE_LOWERCASE),
	_(NCSS_TE_NOHIDESEL),
	_(NCSS_TE_AUTOWRAP),
	_(NCSS_TE_BASELINE),
	_(NCSP_TE_READONLY),
	_(NCSP_TE_SCROLL_MODE),
	_(NCSP_TE_SCROLL_VSTEP),
	_(NCSP_TE_SCROLL_HSTEP),
	_(NCSP_TE_TEXTLIMIT),
	_(NCSN_TE_CONTENTCHANGED),
	_(NCSN_TE_SETFOCUS),
	_(NCSN_TE_KILLFOCUS),
	_(NCSN_TE_MAXTEXT),
	_(NCSN_TE_CHANGE),
	_(NCSN_TE_UPDATE),
	_(NCSN_TE_SELCHANGED),
	_(NCSS_ASTLST_AUTOSORT),
	_(NCSP_ASTLST_DEFNODEHEIGHT),
	_(NCSP_ASTLST_FONTSIZE),
	_(NCSP_ASTLST_AUTOSORT),
	_(NCSP_ASTLST_TRANSPARENT),
	_(NCSP_ASTLST_CMPNODEFUNC),
	_(NCSP_ASTLST_ROOTNODE),
	_(NCSP_ASTLST_TEXTINDENT),
	_(NCSP_ASTLST_IMAGEINDENT),

#ifdef _MGNCSCTRL_LIST
	_(NCSS_LIST_LOOP),
	_(NCSS_LIST_MULTIPLE),
	_(NCSP_LIST_LAYOUT),
	_(NCSP_LIST_DEFNODEWIDTH),
#endif
};

int main(int argc, const char* argv[])
{
	int i;

	if (argc > 1) {
		int j;

		if (strcasecmp("-find", argv[1])==0) {
			for (j=2; j<argc;j++) {
				int v = strtol(argv[j],NULL,0);
				for (i=0;i<sizeof(name_values)/sizeof(char*[2]);i++) {
					if ((int)name_values[i][1] == v)
						printf("%s:%s\n",argv[j],name_values[i][0]);
				}
			}
			return 0;
		} else if (strcasecmp("-help",argv[1]) == 0
				|| strcasecmp("-h", argv[1]) == 0
				|| strcasecmp("-?", argv[1]) == 0) {
			printf("usage %s [options] [name1 [name2 ...]]|[value1 [value2 ...]]\n",argv[0]);
			printf("\t%s\t\t\t-- Show All Marco's of NCS\n",argv[0]);
			printf("\t%s name1 [name2,[name3 ..]]\t-- Show the specail names\n",argv[0]);
			printf("\t%s -find value1 [value2 [value3...]]\t -- Find the name by value\n",argv[0]);
			return 0;
		}

		for (j=1; j<argc; j++) {
			for (i=0; i<sizeof(name_values)/sizeof(char*[2]); i++) {
				if (strcasecmp(name_values[i][0],argv[j])==0)
				{
					if (strncmp(name_values[i][0], "NCSS",4) == 0)
						printf("%s=0x%X\n",name_values[i][0], (int) name_values[i][1]);
					else
						printf("%s=%d\n",name_values[i][0], (int) name_values[i][1]);
					break;
				}
			}
		}
		return 0;
	}
	for (i=0; i<sizeof(name_values)/sizeof(char*[2]); i++) {
			if (strncmp(name_values[i][0], "NCSS",4) == 0)
				printf("%s=0x%X\n",name_values[i][0], (int) name_values[i][1]);
			else
				printf("%s=%d\n",name_values[i][0], (int) name_values[i][1]);
	}

	return 0;
}

